package demo2;
class Solution {
    public static int searchInsert(int[] nums, int target) {
        int left = 0 , right= nums.length-1 ;
        while(left < right){
            int mid = (left+right)/2;
            if(nums[mid] > target){
                right = mid  ;
            }else{
                left = mid+1 ;
            }
        }
        return left ;
    }
}
public class Test1 {
    public static void main(String[] args) {
       int[] arr = {1,3,5,6} ;
        System.out.println(Solution1.searchInsert(arr, 2));
    }
}
